#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void)
{
	char OldID[15];
	int Int_OldID[15];
	int NewIntId[17];
	char NewID[18];
	int num[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
	char checkcode[11]={'1','0','x','9','8','7','6','5','4','3','2'};
	int i,j,sum=0,mod;
	scanf("%s",OldID);
	
	for(i=0;i<15;i++)
	   Int_OldID[i] = OldID[i] - '0';
	
	for(i=0;i<15;i++)
	{
		NewIntId[i] = Int_OldID[i];
		if(i==5&&i<14)
		{
			NewIntId[6] = 1;
			NewIntId[7] = 9;
			NewIntId[i+3] = Int_OldID[i+1];
		} 
	}
	 
	for(i=0;i<17;i++)
	{
		sum = sum + NewIntId[i] * num[i];
	}
	mod = sum % 11;  
	
	for(i=0;i<17;i++)
	   NewID[i] = NewIntId[i] + '0';
	NewID[17] = checkcode[mod];
	
	puts(NewID);
	
	return 0;
} 
